package yr.website

import grails.transaction.Transactional
import org.springframework.beans.factory.annotation.Value

@Transactional
class ApplyService {

    @Value('${address.ul}')
    protected String URLS

    def Boolean add(String path, Apply apply) {
        def flag = true
        apply.filePath = path
        apply.applyDate = new Date()
        apply.state = true
        apply.save()
        if (!apply.save()) {
            apply.errors.allErrors.each {
                println it
            }
            flag = false
        }
        return flag
    }

    def changeState(Apply apply) {
        apply.state = false
        apply.save()
        if (!apply.save()) {
            apply.errors.allErrors.each {
                println it
            }
        }
    }
}
